﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyDMS.DAL;

namespace MyDMS_ExtJS
{
    public partial class DocEditor : System.Web.UI.Page
    {
        protected string DocUrl = string.Empty;
        private MyDMSEntity myDmsEntity = new MyDMSEntity();
        private int _task_code = 0;
        private int _proj_code = 0;
        private int _dept_code = 0;
        private int _folder_code = 0;
        protected string Act = string.Empty;
        protected string DocType = string.Empty;
        private int _doc_Id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Request.QueryString["act"]!=null)
            {
                Act = Request.QueryString["act"].ToString();
            }
            if(Request.QueryString["id"]!=null)
            {
                _doc_Id = Convert.ToInt32(Request.QueryString["id"]);
            }
            if(Request.QueryString["doctype"]!=null)
            {
                DocType = Request.QueryString["doctype"].ToString();
            }
            var firstOrDefault = myDmsEntity.Document.FirstOrDefault(d => d.Document_Code == _doc_Id);
            if (firstOrDefault != null)
            {
                var filePath = firstOrDefault.File_Path;
                DocUrl=filePath.Remove(0, Server.MapPath("/").Length);
            }
            //DocUrl = "~\\"+ string.Format("Upload/UserData/Files/{0}/{1}/{2}/{3}/", _dept_code, _proj_code, _task_code,_folder_code);
            DocUrl = "htpp://221.1.179.14:82" + "/"+DocUrl.Replace("\\","/");
        }
    }
}